<?php
include("./common/conn.php");

class Water {
	public function get_order() {
		$sql = "SELECT numbers, totalprice, first_coupon_price, coupon_price, fan_yong_price, fan_juan_price, distribution_fee, blance_price, balance_time  FROM goodsorders WHERE shopid = 2545";
		$reslut = mysql_query($sql);
		$i = 0;
		while ($row = mysql_fetch_array($reslut)) {
			$data[$i]['numbers']            =		$row['numbers'];
			$data[$i]['totalprice']         =		$row['totalprice'];
			$data[$i]['first_coupon_price'] =		$row['first_coupon_price'];
			$data[$i]['fan_yong_price']     =		$row['fan_yong_price'];
			$data[$i]['coupon_price']       =		$row['coupon_price'];
			$data[$i]['fan_juan_price']     =		$row['fan_juan_price'];
			$data[$i]['distribution_fee']   =		$row['distribution_fee'];
			$data[$i]['blance_price']       = 		$row['blance_price'];
			$data[$i]['balance_time']       = 		$row['balance_time'];

			$total['to_price'] 				+= 		$row['totalprice'];
			$total['fre_price']				+=		$row['first_coupon_price'];
			$total['cou_price']				+=		$row['coupon_price'];
			$total['yong_price']			+=		$row['fan_yong_price'];
			$total['fan_price']				+=		$row['fan_juan_price'];
			$total['dis_price']				+=		$row['distribution_fee'];
			$total['blance_price']			+=		$row['blance_price'];
			$i++;
		}
		// var_dump($total);die;
		return array($data,$total);
	}
}


$water = new Water();

$res = $water->get_order();
